package com.ugoodtech.mdcc.core.dto;


import com.ugoodtech.mdcc.core.domain.Station;
import com.ugoodtech.mdcc.core.utils.StatusUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

/**
 * Copyright © 2013 All Rights Reserved, Ugood Technology, Inc.
 */
@ApiModel("维修站")
public class StationResponse {
    @ApiModelProperty("维修站id")
    private Long stationId;
    @ApiModelProperty("站点名称")
    private String name;
    @ApiModelProperty("省份城市")
    private String city;
    @ApiModelProperty("详细地址")
    private String detailAddress;
    @ApiModelProperty("站点类型")
    private String type;
    @ApiModelProperty("使用品牌")
    private String brand;
    @ApiModelProperty("状态")
    private String status;
    @ApiModelProperty("报告Id")
    private Long reportId;
    @ApiModelProperty("维修站编号")
    private String stationNum;
    @ApiModelProperty("创建时间（报告）")
    private String dateTimeStr;
    @ApiModelProperty("外勤人员姓名")
    private String userName;
    @ApiModelProperty("报告审核状态")
    private String auditType;
    @ApiModelProperty("省份")
    private String province;
    @ApiModelProperty("经销商名称")
    private String dealersName = "";

    private String customerStat = "";

    private String customerType = "";

    public StationResponse() {
    }

    public StationResponse(Station station) {
        this.stationId = station.getId();
        this.name = station.getName();
        if (StringUtils.isNotEmpty(station.getProvince()) && StringUtils.isNotEmpty(station.getCity())) {
            this.city = station.getProvince() + station.getCity();
        } else {
            this.city = "";
        }
        if (StringUtils.isNotEmpty(station.getStationNum())) {
            this.stationNum = station.getStationNum();
        } else {
            this.stationNum = "";
        }
        if (station.getProvince().equals(station.getCity())) {
            this.detailAddress = station.getProvince();
        } else {
            this.detailAddress = station.getProvince() + station.getCity();
        }
        this.type = station.getCategory();
        this.status = StatusUtil.getStatusStr(station.isEnabled(), "冻结站点", "激活站点");
    }

    public Long getStationId() {
        return stationId;
    }

    public void setStationId(Long stationId) {
        this.stationId = stationId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getDetailAddress() {
        return detailAddress;
    }

    public void setDetailAddress(String detailAddress) {
        this.detailAddress = detailAddress;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Long getReportId() {
        return reportId;
    }

    public void setReportId(Long reportId) {
        this.reportId = reportId;
    }

    public String getStationNum() {
        return stationNum;
    }

    public void setStationNum(String stationNum) {
        this.stationNum = stationNum;
    }

    public String getDateTimeStr() {
        return dateTimeStr;
    }

    public void setDateTimeStr(String dateTimeStr) {
        this.dateTimeStr = dateTimeStr;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getAuditType() {
        return auditType;
    }

    public void setAuditType(String auditType) {
        this.auditType = auditType;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCustomerStat() {
        return customerStat;
    }

    public void setCustomerStat(String customerStat) {
        this.customerStat = customerStat;
    }

    public String getCustomerType() {
        return customerType;
    }

    public void setCustomerType(String customerType) {
        this.customerType = customerType;
    }

    public String getDealersName() {
        return dealersName;
    }

    public void setDealersName(String dealersName) {
        this.dealersName = dealersName;
    }

    //    public static StationResponse turnNotificationMessageToResponse(NotificationMessage notificationMessage) throws InvocationTargetException, IllegalAccessException {
//        if (null != notificationMessage) {
//            SimpleDateFormat defaultFormat = new SimpleDateFormat(Constants.DATE_TIME_FORMAT);
//            StationResponse notificationMessageResponse = new StationResponse();
//            BeanUtilEx.copyProperties(notificationMessageResponse, notificationMessage);
//            notificationMessageResponse.setNotificationMessageId(notificationMessage.getId());
//            if (null != notificationMessage.getCreationTime()) {
//                notificationMessageResponse.setCreationTimeStr(defaultFormat.format(notificationMessage.getCreationTime()));
//            }
//            if (null != notificationMessage.getDeliveryTime()) {
//                notificationMessageResponse.setPushTimeStr(defaultFormat.format(notificationMessage.getDeliveryTime()));
//            }
//            if (notificationMessage.isPushed()) {
//                notificationMessageResponse.setPushedStr("已推送");
//            } else {
//                notificationMessageResponse.setPushedStr("未推送");
//            }
////            if (null != notificationMessage.getPublisher()) {
////                notificationMessageResponse.setPublisherName(notificationMessage.getPublisher().getUsername());
////            }
//            return notificationMessageResponse;
//        } else {
//            return null;
//        }
//    }
//
//    public static NotificationMessage turnResponseToNotificationMessage(StationResponse notificationMessageResponse) throws ParseException, InvocationTargetException, IllegalAccessException {
//        if (null != notificationMessageResponse) {
//            SimpleDateFormat defaultFormat = new SimpleDateFormat(Constants.DATE_TIME_FORMAT);
//            NotificationMessage notificationMessage = new NotificationMessage();
//            BeanUtilEx.copyProperties(notificationMessage, notificationMessageResponse);
//            notificationMessage.setId(notificationMessageResponse.notificationMessageId);
//            return notificationMessage;
//        } else {
//            return null;
//        }
//    }
}
